import 'dart:ui' as ui;
import 'package:flutter/material.dart';

import 'base/axis_entity.dart';

/// 雷达图点数据
class RadarEntity extends AxisEntity {
  RadarEntity(
      {this.drawLabel = false,
      this.label,
      this.labelTextSize = 12,
      this.labelColor = Colors.black,
      this.drawIndicator = false,
      this.indicatorDrawable,
      this.indicatorColor,
      this.indicatorSize = 6,
      this.labelOffset = 0,
      super.xIndex,
      super.value,
      super.isDraw,
      super.data})
      : assert(labelTextSize > 0),
        assert(indicatorSize > 0);

  /// 是否绘制标签
  final bool drawLabel;

  /// 标签值
  final String? label;

  /// 标签字体大小
  final double labelTextSize;

  /// 标签字体颜色
  final Color labelColor;

  /// 是否绘制指示器
  final bool drawIndicator;

  /// 指示器颜色，如果设置了此值也设置了[indicatorDrawable],则优先使用[indicatorDrawable]。
  final Color? indicatorColor;

  /// 指示器图标
  final ui.Image? indicatorDrawable;

  /// 指示器大小
  final double indicatorSize;

  /// 标签离[value]绘制位置的偏移距离
  final double labelOffset;
}

/// 雷达图数据
class RadarData {
  const RadarData(
      {this.values,
      this.lineWidth = 1,
      this.lineColor = Colors.grey,
      this.fillBg = false,
      this.fillBgColor,
      this.fillBgDrawable,
      this.isNeedDrawPoint = false,
      this.pointSize = 3,
      this.pointBgColor = Colors.grey})
      : assert(lineWidth > 0);

  final List<RadarEntity>? values;

  /// 绘制折线宽度
  final double lineWidth;

  /// 绘制折线颜色
  final Color lineColor;

  /// 是否填充背景
  final bool fillBg;

  /// 填充的背景颜色，如果设置了此值也设置了[fillBgDrawable],则优先使用[fillBgDrawable]。
  final Color? fillBgColor;

  /// 填充的背景图像
  final ui.Image? fillBgDrawable;

  /// 是否需要画每个数据点
  final bool? isNeedDrawPoint;

  /// 数据点大小
  final double pointSize;

  /// 数据点颜色
  final Color pointBgColor;
}
